<template>
    <div>
        <h1>修改页面</h1>
        <table border>
            <tbody>
                <tr>
                    <td>券类型</td>
                    <td><input type="text" v-model="queryinfo.shopType" /></td>
                </tr>
                <tr>
                    <td>代金券标题</td>
                    <td><input type="text" v-model="queryinfo.title" /></td>
                </tr>
                <tr>
                    <td>代金券副标题</td>
                    <td><input type="text" v-model="queryinfo.fTitle" /></td>
                </tr>
                <tr>
                    <td>代金券图片</td>
                    <td><input type="file" /></td>
                </tr>
                <tr>
                    <td>剩余库存</td>
                    <td><input type="text" v-model="queryinfo.sum" /></td>
                </tr>
                <tr>
                    <td>每人限领</td>
                    <td><input type="text" v-model="queryinfo.xl" /></td>
                </tr>
                <tr>
                    <td>使用条件</td>
                    <td><input type="text" v-model="queryinfo.money" /></td>
                </tr>
                <tr>
                    <td>减免金额</td>
                    <td><input type="text" v-model="queryinfo.jmmoney" /></td>
                </tr>
                <tr>
                    <td>有效期</td>
                    <td><input type="text" v-model="queryinfo.beginTime" />-<input type="text" v-model="queryinfo.endTime" /></td>
                </tr>
                <tr>
                    <td>使用业务</td>
                    <td><input type="text" v-model="queryinfo.yewu" /></td>
                </tr>
                <tr>
                    <td>使用须知</td>
                    <td><textarea rows="5" cols="50" v-model="queryinfo.desc"></textarea></td>
                </tr>
                <tr>
                    <td>适用门店</td>
                    <td>
                        <select v-model="queryinfo.md">
                            <option value="">请选择</option>
                            <option value="北京八维分店">北京八维分店</option>
                            <option value="南京分店">南京分店</option>
                            <option value="合肥分店">合肥分店</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>服务电话</td>
                    <td><input type="text" v-model="queryinfo.phone" /></td>
                </tr>
                <tr>
                    <td></td>
                    <td><input type="button" value="修改" @click="ok" /></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import {ref,reactive} from 'vue'
import { onMounted } from 'vue';
import axios from 'axios'

onMounted(()=>{
    fantian();
})

let id=localStorage["id"];

let queryinfo=reactive({
    "id": id,
  "shopType": "",
  "title": "",
  "fTitle": "",
  "photo": "/wwwroot/pic/3.jpg",
  "sum": 0,
  "xl": 0,
  "money": 0,
  "jmmoney": 0,
  "beginTime": "2024-11-25T01:40:26.423Z",
  "endTime": "2024-11-25T01:40:26.423Z",
  "yewu": "",
  "desc": "",
  "md": "",
  "phone": "",
})

const fantian=()=>{
    axios({
        url:'https://localhost:7248/api/Shop/GetShopById',
        method:'get',
        params:{id:id}
    })
    .then(res=>{
        console.log(res);
        queryinfo.shopType=res.data.shopType;
        queryinfo.title=res.data.title;
        queryinfo.fTitle=res.data.fTitle;
        queryinfo.photo=res.data.photo;
        queryinfo.sum=res.data.sum;
        queryinfo.xl=res.data.xl;
        queryinfo.money=res.data.money;
        queryinfo.jmmoney=res.data.jmmoney;
        queryinfo.beginTime=res.data.beginTime;
        queryinfo.endTime=res.data.endTime;
        queryinfo.yewu=res.data.yewu;
        queryinfo.desc=res.data.desc;
        queryinfo.md=res.data.md;
        queryinfo.phone=res.data.phone;
    })
}

const ok=()=>{
    alert('修改成功');
    location.href='/shoplist'
} 

</script>

<style scoped>

</style>